from letter import filter_letters
from reverse import reverse_string
from enCode import caesar_cipher


def main():
    # 接收用户输入并验证
    while True:
        input_str = input("请输入字符串(长度1-255字符): ")
        if 0 < len(input_str) <= 255:
            break
        print("输入无效！长度必须在1到255个字符之间")

    # 调用各处理模块
    filtered = filter_letters(input_str)
    reversed_str = reverse_string(filtered)
    encrypted = caesar_cipher(reversed_str, shift=3)  # 密钥设为3

    print("\n处理结果:")
    print(f"原始输入: {input_str}")
    print(f"过滤后: {filtered}")
    print(f"反转后: {reversed_str}")
    print(f"加密后: {encrypted}")


if __name__ == "__main__":
    main()